package com.lanou.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.lanou.bean.T8TBuilding;
import com.lanou.bean.T8Tcommodity.Commodity;
import com.lanou.mapper.T8TBuildingMapper;
import com.lanou.mapper.T8TCommodityMapper;
import com.lanou.service.T8TBuildingService;
import com.lanou.utils.AjaxResult;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * Created by dllo on 18/3/16.
 */
@Service
public class T8TBuildingServiceImpl implements T8TBuildingService{
     @Resource
    private T8TBuildingMapper t8TBuildingMapper;
     @Resource
     private T8TCommodityMapper t8TCommodityMapper;

    /**
     *
     * @return 返回 建材城下的分类及下面的子分类
     * 开发人:孙涛
     */
    public List<T8TBuilding> selectAll(){
        return t8TBuildingMapper.findAll();
    }
    @Override
    public AjaxResult findAll() {
        AjaxResult ajaxResult = new AjaxResult();
        ajaxResult.setData(selectAll());
        return ajaxResult;
    }


    public PageInfo<Commodity> findOneSales(Integer pageNum, Integer pageSize,Integer C2ID){
        pageNum = pageNum == null ? 1 : pageNum;//默认为第一页
        pageSize = pageSize == null ? 11 : pageSize;//默认显示条数据
        PageHelper.startPage(pageNum, pageSize);
        List<Commodity> commodities = t8TCommodityMapper.findOneSales(C2ID);
        PageInfo<Commodity>commodityPageInfo = new PageInfo<Commodity>(commodities);
        return commodityPageInfo;
    }
    @Override
    public AjaxResult findOneSalesPage(Integer pageNum, Integer pageSize,Integer C2ID) {
        AjaxResult ajaxResult = new AjaxResult();
        ajaxResult.setData(findOneSales(pageNum, pageSize,C2ID));
        return ajaxResult;
    }

    public PageInfo<Commodity> findTwoSales(Integer pageNum, Integer pageSize,Integer C2ID){
        pageNum = pageNum == null ? 1 : pageNum;//默认为第一页
        pageSize = pageSize == null ? 11 : pageSize;//默认显示条数据
        PageHelper.startPage(pageNum, pageSize);
        List<Commodity> commodities = t8TCommodityMapper.findOneSales(C2ID);
        PageInfo<Commodity>commodityPageInfo = new PageInfo<Commodity>(commodities);
        return commodityPageInfo;
    }
    @Override
    public AjaxResult findTwoSalesPage(Integer pageNum, Integer pageSize,Integer C2ID) {
        AjaxResult ajaxResult = new AjaxResult();
        ajaxResult.setData(findTwoSales(pageNum, pageSize,C2ID));
        return ajaxResult;
    }
    public PageInfo<Commodity> findThreSales(Integer pageNum, Integer pageSize,Integer C2ID){
        pageNum = pageNum == null ? 1 : pageNum;//默认为第一页
        pageSize = pageSize == null ? 11 : pageSize;//默认显示条数据
        PageHelper.startPage(pageNum, pageSize);
        List<Commodity> commodities = t8TCommodityMapper.findOneSales(C2ID);
        PageInfo<Commodity>commodityPageInfo = new PageInfo<Commodity>(commodities);
        return commodityPageInfo;
    }
    @Override
    public AjaxResult findThreeSalesPage(Integer pageNum, Integer pageSize,Integer C2ID) {
        AjaxResult ajaxResult = new AjaxResult();
        ajaxResult.setData(findThreSales(pageNum, pageSize,C2ID));
        return ajaxResult;
    }
    public PageInfo<Commodity> findFourSales(Integer pageNum, Integer pageSize,Integer C2ID){
        pageNum = pageNum == null ? 1 : pageNum;//默认为第一页
        pageSize = pageSize == null ? 11 : pageSize;//默认显示条数据
        PageHelper.startPage(pageNum, pageSize);
        List<Commodity> commodities = t8TCommodityMapper.findOneSales(C2ID);
        PageInfo<Commodity>commodityPageInfo = new PageInfo<Commodity>(commodities);
        return commodityPageInfo;
    }
    @Override
    public AjaxResult findFourSalesPage(Integer pageNum, Integer pageSize,Integer C2ID) {
        AjaxResult ajaxResult = new AjaxResult();
        ajaxResult.setData(findFourSales(pageNum, pageSize,C2ID));
        return ajaxResult;
    }
    public PageInfo<Commodity> findFiveSales(Integer pageNum, Integer pageSize,Integer C2ID){
        pageNum = pageNum == null ? 1 : pageNum;//默认为第一页
        pageSize = pageSize == null ? 11 : pageSize;//默认显示条数据
        PageHelper.startPage(pageNum, pageSize);
        List<Commodity> commodities = t8TCommodityMapper.findOneSales(C2ID);
        PageInfo<Commodity>commodityPageInfo = new PageInfo<Commodity>(commodities);
        return commodityPageInfo;
    }
    @Override
    public AjaxResult findFiveSalesPage(Integer pageNum, Integer pageSize,Integer C2ID) {
        AjaxResult ajaxResult = new AjaxResult();
        ajaxResult.setData(findFiveSales(pageNum, pageSize,C2ID));
        return ajaxResult;
    }
    public PageInfo<Commodity> findSixSales(Integer pageNum, Integer pageSize,Integer C2ID){
        pageNum = pageNum == null ? 1 : pageNum;//默认为第一页
        pageSize = pageSize == null ? 11 : pageSize;//默认显示条数据
        PageHelper.startPage(pageNum, pageSize);
        List<Commodity> commodities = t8TCommodityMapper.findOneSales(C2ID);
        PageInfo<Commodity>commodityPageInfo = new PageInfo<Commodity>(commodities);
        return commodityPageInfo;
    }
    @Override
    public AjaxResult findSixSalesPage(Integer pageNum, Integer pageSize,Integer C2ID) {
        AjaxResult ajaxResult = new AjaxResult();
        ajaxResult.setData(findSixSales(pageNum, pageSize,C2ID));
        return ajaxResult;
    }
    public PageInfo<Commodity> findSevenSales(Integer pageNum, Integer pageSize,Integer C2ID){
        pageNum = pageNum == null ? 1 : pageNum;//默认为第一页
        pageSize = pageSize == null ? 11 : pageSize;//默认显示条数据
        PageHelper.startPage(pageNum, pageSize);
        List<Commodity> commodities = t8TCommodityMapper.findOneSales(C2ID);
        PageInfo<Commodity>commodityPageInfo = new PageInfo<Commodity>(commodities);
        return commodityPageInfo;
    }
    @Override
    public AjaxResult findSevenSalesPage(Integer pageNum, Integer pageSize,Integer C2ID) {
        AjaxResult ajaxResult = new AjaxResult();
        ajaxResult.setData(findSevenSales(pageNum, pageSize,C2ID));
        return ajaxResult;
    }

}
